package com.bwie.controller;

import com.bwie.domain.Good;
import com.bwie.domain.Shenhe;
import com.bwie.mapper.GoodMapper;
import com.bwie.service.Shservice;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author: Li sir
 * @Date: 2025/1/6 10:08
 * @Description:
 **/
@RestController
@RequestMapping("/product/product")
public class Shcontroller {
    @Autowired
    private Shservice shservice;

    @PostMapping("/list")
    public R list(@RequestBody PageInfoVo pageInfoVo){
        return shservice.list(pageInfoVo);
    }
    //修改
    @PostMapping("/update")
    public R update(@RequestBody Shenhe shenhe ,Good good){
        return shservice.update(shenhe ,good);
    }


    @PostMapping("/ist2")
    public R ist2(@RequestBody PageInfoVo pageInfoVo){
        return shservice.ist2(pageInfoVo);
    }

    @PostMapping("/shangchuan")
    public  R shangchaun (@RequestPart("file")MultipartFile file){
        return shservice.shangchuan(file);
    }
   //添加
    @PostMapping("/add")
    public R add(@RequestBody Good good){
        return shservice.add(good);
    }
    //修改
    @PostMapping("/update1")
    public R update1(@RequestBody Good good){
        return shservice.update1(good);
    }

    //删除
    @PostMapping("/delete/{id}")
    public  R delete(@PathVariable("id") Integer id){
        return shservice.delete(id);
    }
}
